-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly register the model classes #1951
Conversation
Couldn’t we instead adjust the |
Thought about the same, but I'm not sure about potential side effects? |
imho we should deprecate that functionality |
Besides the potential side-effects, this would also be a BC break. Someone might have a class |
We can only deprecate it once we have an alternative. And |
I only meant deprecating the automatic inference of the model class according to the table name instead of looking it up in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt you want to override $GLOBALS['TL_MODELS']
in every config file? 😂
This would already fail if in the application config a custom class is registered via |
It certainly was not intended to be used this way! But you know… |
Fixed in 2016f09. |
|
I think it would. But that would be a bug in the extension code, which is easily fixable and fully backwards compatible. |
But I agree, explicitly setting the class names should still be preferred. How about adding a deprecation notice here? (I think @fritzmg suggested something like that?) |
Yep. Adding a deprecation notice there is what I meant :) |
2016f09
to
c88a355
Compare
Deprecation added in c88a355. |
Description ----------- I have realized that using `Model::getRelated()` still relies on the old Contao 3 class autoloader to find the related model class. This is because `Model::getClassFromTable()` only converts `tl_page` to `PageModel` and not to `Contao\PageModel` and therefore we still have "composerized" classes in Contao 4.10 when we really should not anymore. 😄 <img width="724" alt="" src="https://user-images.githubusercontent.com/1192057/88038330-5c9a8080-cb46-11ea-9976-6441d9ab906a.png"> This PR explicitly registers the fully qualified model class names. Commits ------- 9857c38 Explicitly register the model classes 3cb436f Append to TL_MODELS instead of overwriting it c88a355 Trigger a deprecation for unregistered tables
I have realized that using
Model::getRelated()
still relies on the old Contao 3 class autoloader to find the related model class. This is becauseModel::getClassFromTable()
only convertstl_page
toPageModel
and not toContao\PageModel
and therefore we still have "composerized" classes in Contao 4.10 when we really should not anymore. 😄This PR explicitly registers the fully qualified model class names.